package com.iflytek.hive.need7;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class MaxDayGroupingComparator extends WritableComparator {
    protected MaxDayGroupingComparator(){
        super(DayAmountBean.class,true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        DayAmountBean aBean = (DayAmountBean) a;
        DayAmountBean bBean = (DayAmountBean) b;
        String first = aBean.getDate().substring(0,4);
        String secound = bBean.getDate().substring(0,4);
        return first.compareTo(secound);
    }
}
